package com.feiyu.shopsAndgoods.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.feiyu.shopsAndgoods.entity.CheckGoodsEntity;
import com.feiyu.shopsAndgoods.service.CheckGoodsService;
import com.feiyu.common.utils.PageUtils;
import com.feiyu.common.utils.R;



/**
 * 
 *
 * @author wanghanbin
 * @email 1336891708@qq.com
 * @date 2021-04-03 12:36:05
 */
@RestController
@RequestMapping("product/checkgoods")
public class CheckGoodsController {
    @Autowired
    private CheckGoodsService checkGoodsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("product:checkgoods:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = checkGoodsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{checkGoodsId}")
    //@RequiresPermissions("product:checkgoods:info")
    public R info(@PathVariable("checkGoodsId") Integer checkGoodsId){
		CheckGoodsEntity checkGoods = checkGoodsService.getById(checkGoodsId);

        return R.ok().put("checkGoods", checkGoods);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("product:checkgoods:save")
    public R save(@RequestBody CheckGoodsEntity checkGoods){
		checkGoodsService.save(checkGoods);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("product:checkgoods:update")
    public R update(@RequestBody CheckGoodsEntity checkGoods){
		checkGoodsService.updateById(checkGoods);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("product:checkgoods:delete")
    public R delete(@RequestBody Integer[] checkGoodsIds){
		checkGoodsService.removeByIds(Arrays.asList(checkGoodsIds));

        return R.ok();
    }

}
